/* eslint valid-jsdoc: "off" */

'use strict';
const path = require('path');
/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1669102174512_6607';

  // add your middleware config here
  config.middleware = [];
  // secret
  config.jwt = { secret: 'admsh888' };
  // csrf
  config.security = {
    csrf: {
      enable: false,
    },
  };
  // cors
  config.cors = {
    origin: '*',
    allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH',
  };
  // 配置数据库
  config.sequelize = {
    dialect: 'mysql', // 数据库类型
    database: 'admshop1', // 数据库名
    host: 'localhost', // 数据库地址
    port: 3306, // 端口
    username: 'root', // 数据库登录名
    password: '123456', // 数据库密码
    // 设置时间格式
    timezone: '+08:00',
    dialectOptions: {
      dateStrings: true,
      typeCast: true
    }
  };
  // static
  config.static = {
    prefix: '/', // 访问路径
    dir: path.join(appInfo.baseDir, 'app/public')
  };
  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  return {
    ...config,
    ...userConfig,
  };
};
